from importlib.metadata import files
import datetime
import time
files = ['m1_sorted.txt', 'm2_reverse.txt', 'm3_shuffle.txt']
for filename in files:
    start = time.time()
    f = open(filename)
    a = []
    b = 0
    for i in range(5000):
        b += (i**100)
    for i in f.readlines():
        im = i.replace("\n"," ")
        i = int(i)
        a.append(i)
    isSwap = True
    j = len(a)-2
    while isSwap:
        isSwap = False
        for i in range(0,j-1):
            if a[i] > a[i+1]:
                a[i], a[i+1] = a[i+1], a[i]
                isSwap =True
        j -= 1
    finish = time.time()
    res = finish - start


    print(filename, int(res), 'miliseconds',)